package com.linkhub.oms.admin.modules.wms.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckRole;
import com.linkhub.oms.admin.modules.product.domain.param.CreateProcessOrderParam;
import com.linkhub.oms.admin.modules.wms.service.WmsProcessOrderService;
import com.linkhub.oms.common.constant.RoleConstant;
import com.linkhub.oms.common.response.DataResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Description: 加工单管理模块
 * @Author: Jaycle
 * @Date: 2024/6/15 21:43
 * @Version: 1.0
 */
@Slf4j
@RestController
@Api(tags = {"加工单管理模块"})
@RequestMapping("/local_product")
@SaCheckLogin
public class WmsProcessOrderController {

    @Resource
    private WmsProcessOrderService wmsProcessOrderService;

    @PostMapping("/create_process_order")
    @ApiOperation(value = "发起加工单接口")
    @SaCheckRole(value = {RoleConstant.CUSTOMER})
    public DataResponse<Void> createProcessOrder( @RequestBody CreateProcessOrderParam createProcessOrderParam) {
        return DataResponse.success(wmsProcessOrderService.createProcessOrder(createProcessOrderParam));
    }

    @PostMapping("/query_process_order_fee")
    @ApiOperation(value = "加工单费用查询接口")
    @SaCheckRole(value = {RoleConstant.CUSTOMER})
    public DataResponse<Float> queryProcessOrderFee( @RequestBody CreateProcessOrderParam createProcessOrderParam) {
        return DataResponse.success(wmsProcessOrderService.queryProcessOrderFee(createProcessOrderParam));
    }
}
